//
//  YBLearnerDetailTableViewCell.m
//  ZhongWangYuanApp
//
//  Created by apple on 18/6/4.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "YBLearnerDetailTableViewCell.h"

@interface YBLearnerDetailTableViewCell ()
@property (nonatomic , strong) UILabel * cellTitleLabel;

@property (nonatomic , strong) UILabel * cellDetailLabel;
@end

@implementation YBLearnerDetailTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self layoutUI];
    }
    return self;
}


-(void)layoutUI{
    [self.contentView addSubview:self.cellTitleLabel];
    [self.contentView addSubview:self.cellDetailLabel];
    
    self.cellTitleLabel.sd_layout
    .leftSpaceToView(self.contentView , 20 * ItemWidth)
    .rightSpaceToView(self.contentView , 20 * ItemWidth)
    .topSpaceToView(self.contentView , 0)
    .heightIs(74 * ItemHeight);
    
    self.cellDetailLabel.sd_layout
    .leftSpaceToView(self.contentView , 20 * ItemWidth)
    .topSpaceToView(self.cellTitleLabel , 0)
    .widthIs([UIScreen zj_screenWith] - ItemWidth * 40)
    .heightIs(1);
    
}


-(void)setDataWithDic:(NSDictionary *)dic{
    self.cellTitleLabel.text = dic[@"title"];
    self.cellDetailLabel.sd_layout
    .leftSpaceToView(self.contentView , 20 * ItemWidth)
    .topSpaceToView(self.cellTitleLabel , 0)
    .widthIs([UIScreen zj_screenWith] - ItemWidth * 40 + 1)
    .heightIs([dic[@"height"] floatValue] + 1);
    self.cellDetailLabel.attributedText = dic[@"text"];
    [self.cellDetailLabel updateLayout];
}





-(UILabel *)cellTitleLabel
{
    if (!_cellTitleLabel) {
        _cellTitleLabel = [ToolClass creatLabelWithFrame:CGRectMake(ItemWidth * 20, 0, [UIScreen zj_screenWith] - ItemWidth * 40, ItemHeight * 74) font:14 textColor:[UIColor textGrayColor] text:@""];
        _cellTitleLabel.font = LYPBOLDFONT(14);
    }
    return _cellTitleLabel;
}


-(UILabel *)cellDetailLabel
{
    if (!_cellDetailLabel) {
        _cellDetailLabel = [ToolClass creatLabelWithFrame:CGRectMake(ItemWidth * 20, 0, [UIScreen zj_screenWith] - ItemWidth * 40 + 1, 1) font:14 textColor:[UIColor textGrayColor] text:@""];
    }
    return _cellDetailLabel;
}



@end
